package com.company.project.rest;

import com.company.project.protocol.goods.*;
import com.company.project.web.TradeGoodsController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

@Api(value="商品服务")
@Component
@RestController
@RequestMapping("/trade/goods")
public class GoodsApi extends TradeGoodsController {

    /**
     *  查询商品
     * @param queryGoodsReq
     * @return
     */
    @Override
    @ApiOperation(value="查询商品服务")
    @PostMapping("/queryGoods")
    public QueryGoodsRes queryGoods( QueryGoodsReq queryGoodsReq) {
        return this.tradeGoodsService.queryGoods(queryGoodsReq);
    }

    /**
     * 减库存
     * @param reduceGoodsNumberReq
     * @return
     */
    @Override
    @ApiOperation(value="扣减库存")
    @PostMapping("/reduceGoodsNumber")
    public ReduceGoodsNumberRes reduceGoodsNumber( ReduceGoodsNumberReq reduceGoodsNumberReq) {
        return this.tradeGoodsService.reduceGoodsNumber(reduceGoodsNumberReq);
    }

    @Override
    public AddGoodsNumberRes addGoodsNumber(AddGoodsNumberReq addGoodsNumberReq) {
        return this.tradeGoodsService.addGoodsNumber(addGoodsNumberReq);
    }


}
